# 定义一个简单的装饰器
def my_decorator(func):
    def wrapper(*args, **kwargs):
        # 打印函数名和参数
        print(f"Calling function '{func.__name__}' with:") # Calling function 'say_hello' with:
        print(f"Positional args: {args}") # Positional args: ('A',)
        print(f"Keyword args: {kwargs}") # Keyword args: {}

        print("Before the function call")
        result = func(*args, **kwargs)  # 调用原函数
        print("After the function call")
        return result
    return wrapper

# 使用装饰器
@my_decorator
def say_hello(name):
    print(f"Hello, {name}!")

# 调用被装饰的函数
say_hello("A")


def wrapper(*args):
    print(f"Received positional arguments: {args}")
    # 调用被装饰函数时传递这些参数

wrapper(1, 2, 3) # Received positional arguments: (1, 2, 3)

def wrapper(**kwargs):
    print(f"Received keyword arguments: {kwargs}")
    # 调用被装饰函数时传递这些参数

wrapper(a=1, b=2, c=3) # Received keyword arguments: {'a': 1, 'b': 2, 'c': 3}